package cn.zou.blog.service.impl;

import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import cn.zou.blog.dao.GuestBookDao;
import cn.zou.blog.entry.GuestBook;
import cn.zou.blog.service.GuestBookService;
import cn.zou.core.page.Page;

@Service("guestbookService")
@Transactional
public class GuestBookServiceImpl implements GuestBookService {
	@Autowired
	private GuestBookDao guestbookDao;
	public void addGuestBook(GuestBook guestbook) {
		
		guestbookDao.addGuestBook(guestbook);
	}

	public void deleteGuestBookById(String id) {
		guestbookDao.deleteGuestBookById(id);
		
	}

	public void deleteGuestBookByArticleId(String articleId) {
		// TODO 自动生成的方法存根
		guestbookDao.deleteGuestBookByArticleId(articleId);
	}

	public Page<GuestBook> findGuestBook(Map map,int pageNo,int pageSize) {
		Page<GuestBook> page=new Page<GuestBook>(pageSize, pageNo, guestbookDao.findCuntGuestBook(map));
	    page.setItmes(guestbookDao.findGuestBook(map));
		
		return page;
	}

}
